#ifndef TRAFFICWID_H
#define TRAFFICWID_H

#include <QWidget>
#include <QtDesigner/QDesignerExportWidget>
#include <vector>
#include <QLabel>
#include <QMouseEvent>

using namespace std;
namespace Ui {
class TrafficWid;
}

class QDESIGNER_WIDGET_EXPORT TrafficWid : public QWidget
{
    Q_OBJECT

public:
    explicit TrafficWid(QWidget *parent = 0);
    ~TrafficWid();
    //新建label
    void new_label();
    //设置label色块的颜色，长度
    void set_value(int index,QString color,QString text,int value,bool display);
    //设置label色块的数量
    void set_count(int count){
        Count=count;
    }
    int get_count(){
        return Count;
    }
protected:
    //重写mousePressEvent事件
    virtual void mousePressEvent(QMouseEvent* event);
signals:
    void clicked();
private:
    Ui::TrafficWid *ui;

    int Count;

    vector<QLabel*> labelvec;
};

#endif // TRAFFICWID_H
